<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itcast" uri="http://itcast.cn/common/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>登录</title>
<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">
</head>
 <body style="background: url(<%=basePath%>img/4.jpg) no-repeat center;">
<div class="container">
   <div class="col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4">
       <br><br><br><br><br><br><br><br><br><br>
      <div class="panel panel-success">
          <div class="panel-heading">
              <h3 class="panel-title text-center">登录</h3>
          </div>
          <div class="panel-body">

              <form class="bs-example bs-example-form" role="form" id="login_form">
                                  
                                  <div class="input-group">
                                      <span class="input-group-addon">用户名</span>
                                      <input type="text" class="form-control" name="username" placeholder="请输入您的用户名">
                                  </div>
                                  <br>
                                  <div class="input-group">
                                      <span class="input-group-addon">密 &nbsp; 码</span>
                                      <input type="password" class="form-control" name="password"  placeholder="请输入您的密码">
                                  </div>
                                  <br>

                                  <div class="form-group">
                                    <div class="col-xs-offset-2 col-xs-4">
                                      <button type="button" class="btn btn-success" onclick="login()">登录</button>
                                    </div>
                                    <div class="col-xs-offset-1 col-xs-4">
                                      <button type="reset" class="btn btn-info">重置</button>
                                    </div>
                                  </div>
                                  <br><br>

                              </form>
          </div>
      </div>
   </div>
</div>






    <!-- jQuery -->
	<script src="<%=basePath%>js/jquery-3.2.1.min.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="<%=basePath%>js/bootstrap.min.js"></script>
	<script type="text/javascript"> 
      function login() {
			$.post("<%=basePath%>admin/loginVali.action",$("#login_form").serialize(),function(data){
				if(data =='ok'){
					window.location.href='<%=basePath%>admin/index.action';
				}
				
				if(data == 'ko'){
					alert("登录失败，请填用户名和密码！");
				}
				
				
			});
		}
    </script>
  </body>
</html>